#region " using "
using System;
using System.Data;
using System.Collections;
using Smarty;
using System.Configuration;
#endregion

public partial class CMenu : AspNetRunnerPage
{
    void Page_Load( object sender,  System.EventArgs e) 
    {
                        CheckSecurity();
            smarty.Add("body", true);
                        smarty.Add("username",UserName);
            smarty.Add("changepwd_link", AccessLevel != Control.ACCESS_LEVEL_GUEST);
            smarty.Add("changepwdlink_attrs","onclick=\"window.location.href='changepwd.aspx';return false;\"");
            smarty.Add("logoutlink_attrs","onclick=\"window.location.href='login.aspx?a=logout';\"");

            smarty.Add("loggedas_block",true);
            smarty.Add("logout_link",true);

                        bool allow_article = func.CheckUserPermissions("article", "SA");
            if(allow_article)
            {
	            bool createmenu_article = true;
	            smarty.Add("article_tablelink",true);
	            string page_article = "";
	            	            page_article ="list";
	                            	            if(func.CheckUserPermissions("article", "SA"))
                {
		            //page_article="add";
                }
	            smarty.Add("article_tablelink_attrs","href=\"article_" + page_article + ".aspx\"");
            }
                        bool allow_articlecategory = func.CheckUserPermissions("articlecategory", "SA");
            if(allow_articlecategory)
            {
	            bool createmenu_articlecategory = true;
	            smarty.Add("articlecategory_tablelink",true);
	            string page_articlecategory = "";
	            	            page_articlecategory ="list";
	                            	            if(func.CheckUserPermissions("articlecategory", "SA"))
                {
		            //page_articlecategory="add";
                }
	            smarty.Add("articlecategory_tablelink_attrs","href=\"articlecategory_" + page_articlecategory + ".aspx\"");
            }
                        bool allow_catedetailproduct = func.CheckUserPermissions("catedetailproduct", "SA");
            if(allow_catedetailproduct)
            {
	            bool createmenu_catedetailproduct = true;
	            smarty.Add("catedetailproduct_tablelink",true);
	            string page_catedetailproduct = "";
	            	            page_catedetailproduct ="list";
	            	            smarty.Add("catedetailproduct_tablelink_attrs","href=\"catedetailproduct_" + page_catedetailproduct + ".aspx\"");
            }
                        bool allow_category = func.CheckUserPermissions("category", "SA");
            if(allow_category)
            {
	            bool createmenu_category = true;
	            smarty.Add("category_tablelink",true);
	            string page_category = "";
	            	            page_category ="list";
	                            	            if(func.CheckUserPermissions("category", "SA"))
                {
		            //page_category="add";
                }
	            smarty.Add("category_tablelink_attrs","href=\"category_" + page_category + ".aspx\"");
            }
                        bool allow_categorydetail = func.CheckUserPermissions("categorydetail", "SA");
            if(allow_categorydetail)
            {
	            bool createmenu_categorydetail = true;
	            smarty.Add("categorydetail_tablelink",true);
	            string page_categorydetail = "";
	            	            page_categorydetail ="list";
	                            	            if(func.CheckUserPermissions("categorydetail", "SA"))
                {
		            //page_categorydetail="add";
                }
	            smarty.Add("categorydetail_tablelink_attrs","href=\"categorydetail_" + page_categorydetail + ".aspx\"");
            }
                        bool allow_customer = func.CheckUserPermissions("customer", "SA");
            if(allow_customer)
            {
	            bool createmenu_customer = true;
	            smarty.Add("customer_tablelink",true);
	            string page_customer = "";
	            	            page_customer ="list";
	                            	            if(func.CheckUserPermissions("customer", "SA"))
                {
		            //page_customer="add";
                }
	            smarty.Add("customer_tablelink_attrs","href=\"customer_" + page_customer + ".aspx\"");
            }
                        bool allow_feedback = func.CheckUserPermissions("feedback", "SA");
            if(allow_feedback)
            {
	            bool createmenu_feedback = true;
	            smarty.Add("feedback_tablelink",true);
	            string page_feedback = "";
	            	            page_feedback ="list";
	                            	            if(func.CheckUserPermissions("feedback", "SA"))
                {
		            //page_feedback="add";
                }
	            smarty.Add("feedback_tablelink_attrs","href=\"feedback_" + page_feedback + ".aspx\"");
            }
                        bool allow_forum = func.CheckUserPermissions("forum", "SA");
            if(allow_forum)
            {
	            bool createmenu_forum = true;
	            smarty.Add("forum_tablelink",true);
	            string page_forum = "";
	            	            page_forum ="list";
	                            	            if(func.CheckUserPermissions("forum", "SA"))
                {
		            //page_forum="add";
                }
	            smarty.Add("forum_tablelink_attrs","href=\"forum_" + page_forum + ".aspx\"");
            }
                        bool allow_productdetail = func.CheckUserPermissions("productdetail", "SA");
            if(allow_productdetail)
            {
	            bool createmenu_productdetail = true;
	            smarty.Add("productdetail_tablelink",true);
	            string page_productdetail = "";
	            	            page_productdetail ="list";
	                            	            if(func.CheckUserPermissions("productdetail", "SA"))
                {
		            //page_productdetail="add";
                }
	            smarty.Add("productdetail_tablelink_attrs","href=\"productdetail_" + page_productdetail + ".aspx\"");
            }
                        bool allow_receiveemail = func.CheckUserPermissions("receiveemail", "SA");
            if(allow_receiveemail)
            {
	            bool createmenu_receiveemail = true;
	            smarty.Add("receiveemail_tablelink",true);
	            string page_receiveemail = "";
	            	            page_receiveemail ="list";
	                            	            if(func.CheckUserPermissions("receiveemail", "SA"))
                {
		            //page_receiveemail="add";
                }
	            smarty.Add("receiveemail_tablelink_attrs","href=\"receiveemail_" + page_receiveemail + ".aspx\"");
            }
                        bool allow_sponsor = func.CheckUserPermissions("sponsor", "SA");
            if(allow_sponsor)
            {
	            bool createmenu_sponsor = true;
	            smarty.Add("sponsor_tablelink",true);
	            string page_sponsor = "";
	            	            page_sponsor ="list";
	                            	            if(func.CheckUserPermissions("sponsor", "SA"))
                {
		            //page_sponsor="add";
                }
	            smarty.Add("sponsor_tablelink_attrs","href=\"sponsor_" + page_sponsor + ".aspx\"");
            }
                        bool allow_user = func.CheckUserPermissions("user", "SA");
            if(allow_user)
            {
	            bool createmenu_user = true;
	            smarty.Add("user_tablelink",true);
	            string page_user = "";
	            	            page_user ="list";
	                            	            if(func.CheckUserPermissions("user", "SA"))
                {
		            //page_user="add";
                }
	            smarty.Add("user_tablelink_attrs","href=\"user_" + page_user + ".aspx\"");
            }

            
            output.Append(func.BuildOutput(this, @"~\admin\menu.aspx", smarty));
            this.Response.Write(output.ToString());
            this.Response.End();
    }

        private bool CheckSecurity()
    {
        if(string.IsNullOrEmpty(UserName))
        { 
            MyUrl = this.Request.AppRelativeCurrentExecutionFilePath;
            this.Server.Transfer("~/admin/login.aspx?message=expired");
	        return false;
        }
        
        return true;
    }
}
